<?php
// MyMyUNSW: session handling functions

// isLoggedIn:
// - check that this is a session by a logged-in user
 
function userClassID()
{
	if (!isset($_SESSION["classID"]))
		return -1;
	else
		return $_SESSION["classID"];
}
 
function userCourseName()
{
	if (!isset($_SESSION["courseName"]))
		return "???";
	else
		return $_SESSION["courseName"];
}

function userClassStartTime()
{
   if (!isset($_SESSION["startTime"])) {
      return "???";
   } else {
      return $_SESSION["startTime"];
   }
}

function userClassFinishTime()
{
   if (!isset($_SESSION["finishTime"])) {
      return "???";
   } else {
      return $_SESSION["finishTimex"];
   }
}

function userQuestions()
{
   if (!isset($_SESSION["questions"])) {
      return array(array(
               "qID" => 0,
               "qNum" => 0,
               "qType" => "Open",
               "qDescrip" => "",
               "possAnswers" => array()));
   } else {
      return $_SESSION["questions"];
   }
}

function userAnsweredQuestions()
{
   if (!isset($_SESSION["answeredQuestions"])) {
      return array();
   } else {
      return $_SESSION["answeredQuestions"];
   }
}
 
/*function userType()
{
	if (!isset($_SESSION["myType"]))
		return "???";
	else
		return $_SESSION["myType"];
}*/

/****
function isLoggedIn() { return true; }
function isStudent() { return false; }
function isStaff() { return true; }
function isAdmin() { return false; }
*****/
//function isLoggedIn() { return isset($_SESSION['classID']); }
function isLoggedIn() { return isset($_SESSION['loggedIn']); }
/*function isStudent() { return (userType() == "student"); }
function isStaff() { return (userType() == "staff"); }
function isAdmin() { return (userType() == "admin"); }*/
